/**
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-07 13:44:19
 * Copyright (c) 2015- joysuch-版权所有
 */
package com.joysuch.wwyt.bp.repository;

import com.joysuch.wwyt.bp.entity.BpEmergencyTrainingDrill;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

import java.util.Date;
import java.util.List;


/**
 * BpEmergencyTrainingDrillDao
 *
 */
public interface BpEmergencyTrainingDrillDao extends JpaRepository<BpEmergencyTrainingDrill, Long>, QuerydslPredicateExecutor<BpEmergencyTrainingDrill>  {
    public Page<BpEmergencyTrainingDrill> findAll(Specification<BpEmergencyTrainingDrill> spec, Pageable pageable);

    public BpEmergencyTrainingDrill save(BpEmergencyTrainingDrill bean);

    public void delete(BpEmergencyTrainingDrill bean);

    List<BpEmergencyTrainingDrill> findByName(String name);


    @Query(value = "select * from wwyt_bp_emergency_training_drill where drill_time_start between ?1 and ?2 and delete_flag = '0' ",nativeQuery = true)
    List<BpEmergencyTrainingDrill> findExpired(Date startDate, Date endDate);
}
